using System.Collections.Generic;

namespace PKGames.Voxel.Analytics
{
	public class NpcInteractionEventGroup
	{
		private readonly Dictionary<string, NpcInteractionEvent> _npcInteractions = new Dictionary<string, NpcInteractionEvent>();

		private readonly string _levelName;

		public NpcInteractionEventGroup(string levelName)
		{
			_levelName = levelName;
		}

		public void OnNpcInteraction(string npcType)
		{
			if (!_npcInteractions.ContainsKey(npcType))
			{
				_npcInteractions[npcType] = new NpcInteractionEvent(_levelName, npcType);
			}
			_npcInteractions[npcType].NpcInteracted();
		}

		public void FinishAndLog()
		{
			foreach (NpcInteractionEvent value in _npcInteractions.Values)
			{
				value.Finish();
				value.Log();
			}
		}
	}
}
